package com.springboot.erp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.erp.entity.JshDepot;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface JshDepotMapper extends BaseMapper<JshDepot> {
    Page<JshDepot> selectForPagesD(@Param("name") String name, @Param("remark") String remark,
                                        Page<JshDepot> page);
@Insert("INSERT INTO jsh_depot ( name, address, warehousing, truckage, principal, remark, sort, enabled, is_default, delete_Flag) VALUES (#{name},#{address},#{warehousing},#{truckage},#{principal},#{remark},#{sort},#{enabled},#{isDefault},#{deleteFlag})")
@Options(useGeneratedKeys = true, keyProperty = "id")
void insrtOneD(JshDepot jshDepot);


@Select("UPDATE jsh_depot SET name = #{name}, address = #{address}, warehousing = #{warehousing}, truckage = #{truckage}, principal = #{principal}, remark = #{remark}, sort = #{sort}, enabled = #{enabled}, is_default = #{isDefault}, delete_Flag = #{deleteFlag} WHERE id = #{id}")
void updateOneD(JshDepot jshDepot);

@Select("DELETE FROM jsh_depot WHERE id = #{id} and delete_Flag = 0")
void deleteOneD(@Param("id") Integer id);
}
